package com.atguigu.srb.core.controller;

import com.atguigu.common.result.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version V1.0
 * @author: guangcheng
 * @date: 2021/4/27 16:44
 * @description:
 */
@RestController
@RequestMapping("/api/core/vue")
public class LoginControllerForVue {


    //暂时不做认证授权业务...先写其他业务员
    @PostMapping("/login")
    public R login() {
        return R.ok().data("token", "admin");
    }

    /**
     * http://localhost/img/xyx.png
     * https://tvax2.sinaimg.cn/crop.0.0.664.664.180/006ZOGmOly8fmiu3ju496j30ig0iggmg.jpg?KID=imgbed,tva&Expires=1619524948&ssig=Hq3nq4Ew%2FA
     * https://shp.qlogo.cn/ttsing/183567086/183567086/100?ts=0
     *
     * @return
     */
    @GetMapping("/info")
    public R info() {
        return R.ok()
                .data("roles", "[admin]")
                .data("name", "admin")
                .data("avatar", "https://tva1.sinaimg.cn/crop.0.0.750.750.180/b10d83d8jw8f53xpxjlhaj20ku0kut9k.jpg?KID=imgbed,tva&Expires=1619525075&ssig=slrucS5Fdi");
    }

    @PostMapping("/logout")
    public R logout() {
        return R.ok().data("code", 20000).data("data", "success");
    }

}

